package com.lluohao.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Created by Everthing-- on 2017/7/5.
 */
public class StringUtils {
    public static String readFromInputStream(InputStream is, String charset) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset));
        StringBuilder builder = new StringBuilder();
        String line = null;
        while((line=reader.readLine())!=null){
            builder.append(line+"\n");
        }
        return builder.toString();
    }

    public static boolean notNull(String str){
        return str!=null&&str.length()>0;
    }
}
